package com.cayte.create2dcode;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class MainActivity extends Activity {
	ImageView view;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		view = new ImageView(this);
		view.setBackgroundColor(Color.WHITE);
		view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));
		view.setScaleType(ScaleType.CENTER_INSIDE);
		view.setImageResource(R.drawable.ic_launcher);

		setContentView(view);

		view.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				CayteCreate2DCode ccc = new CayteCreate2DCode();
				ccc.setLength(200);
				Bitmap bit = ccc
						.Create2DCode("http://www.ecpic.com.cn/cpicweb/a2/reprocess/intention/VehicleBusinessInfoController.do");
				view.setImageBitmap(bit);
			}
		});
	}

}
